package sk.alligator;

import java.io.IOException;
import java.util.Enumeration;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class Home
 */
@WebServlet({"/", "/home", "/index.html" })
public class Home extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		response.getWriter().append("<!DOCTYPE html><html><head><title>" + Home.class.getName() + " 3.0</title></head><body>");
		response.getWriter().append("<h3>");
		response.getWriter().append(Home.class.getCanonicalName() + " 3.0");
		response.getWriter().append("</h3>");
		response.getWriter().append("</p>");
		
		Enumeration<String> e = request.getParameterNames();
		while(e.hasMoreElements()){
			String s = request.getParameter(e.nextElement());
			response.getWriter().append(s + "<br />");
		}
		
		response.getWriter().append("</p>");
		response.getWriter().append("</body></html>");
	}

}
